package com.fay.basic.base.extend;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Person {
    private String name;
    private int age;

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (null == obj || getClass() != obj.getClass()) {
            return false;
        }
        Person anotherPerson = (Person) obj;
        if (anotherPerson.getAge() == this.getAge()
                && anotherPerson.getName().equals(this.getName())) {
            return true;
        }
        return false;
    }
}
